import 'dart:html';

import 'package:flutter/material.dart';


import 'dart:io';

import '../blocdemo/main03.dart';



void main() => runApp( MyApp());

///滑动删除模块
class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: MyHome(),
    );
  }
}

class MyHome extends StatefulWidget {
  MyHome({super.key});

  @override
  State<MyHome> createState() => _MyHomeState();
}

class _MyHomeState extends State<MyHome> {
  final List<String> items = new List<String>.generate(30, (index) => "items ${index+1}");

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(title: Text('swipe to dismiss'),),
      body: ListView.builder(
        itemCount: items.length,
        itemBuilder: ( context,  index){
          return Dismissible(key: new Key(items[index]),
              onDismissed: (direction)  {
                items.removeAt(index);
                Scaffold.of(context).showBottomSheet
                  ((context)=> Text('data'));

              },
              child: ListTile(
                title: Text('${items[index]}'),
              ));
        },
      ),
    );
  }
}

